If turn.Caption = "X" And s(y).Caption = "" And cwon = False And iwon = False And tie = False Then
s(y).Caption = "X"
turn.Caption = "O"
End If
If turn.Caption = "O" And s(y).Caption = "" And cwon = False And iwon = False And tie = False Then
s(y).Caption = "O"
turn.Caption = "X"
End If
End Sub
Private Sub Timer1_Timer()
'Checks to see if anyone has one
If s(0).Caption = "X" And s(1).Caption = "X" And s(2).Caption = "X" Then
iwon = True
cwon = False
tie = False
Line5(0).Visible = True
End If
If s(3).Caption = "X" And s(4).Caption = "X" And s(5).Caption = "X" Then
iwon = True
cwon = False
tie = False
Line5(1).Visible = True
End If
If s(6).Caption = "X" And s(7).Caption = "X" And s(8).Caption = "X" Then
iwon = True
cwon = False
tie = False
Line5(2).Visible = True
End If
If s(0).Caption = "X" And s(3).Caption = "X" And s(6).Caption = "X" Then
iwon = True
cwon = False
tie = False
Line5(3).Visible = True
End If
If s(1).Caption = "X" And s(4).Caption = "X" And s(7).Caption = "X" Then
iwon = True
cwon = False
tie = False
Line5(4).Visible = True
End If
If s(2).Caption = "X" And s(5).Caption = "X" And s(8).Caption = "X" Then
iwon = True
cwon = False
tie = False
Line5(5).Visible = True
End If
If s(0).Caption = "X" And s(4).Caption = "X" And s(8).Caption = "X" Then
iwon = True
cwon = False
tie = False
Line5(6).Visible = True
End If
If s(2).Caption = "X" And s(4).Caption = "X" And s(6).Caption = "X" Then
iwon = True
cwon = False
tie = False
Line5(7).Visible = True
End If
If s(0).Caption = "O" And s(1).Caption = "O" And s(2).Caption = "O" Then
iwon = False
cwon = True
tie = False
Line5(0).Visible = True
End If
If s(3).Caption = "O" And s(4).Caption = "O" And s(5).Caption = "O" Then
iwon = False
cwon = True
tie = False
Line5(1).Visible = True
End If
If s(6).Caption = "O" And s(7).Caption = "O" And s(8).Caption = "O" Then
iwon = False
cwon = True
tie = False
Line5(2).Visible = True
End If
If s(0).Caption = "O" And s(3).Caption = "O" And s(6).Caption = "O" Then
iwon = False
cwon = True
tie = False
Line5(3).Visible = True
End If
If s(1).Caption = "O" And s(4).Caption = "O" And s(7).Caption = "O" Then
iwon = False
cwon = True
tie = False
Line5(4).Visible = True
End If
If s(2).Caption = "O" And s(5).Caption = "O" And s(8).Caption = "O" Then
iwon = False
cwon = True
tie = False
Line5(5).Visible = True
End If
If s(0).Caption = "O" And s(4).Caption = "O" And s(8).Caption = "O" Then
iwon = False
cwon = True
tie = False
Line5(6).Visible = True
End If
If s(2).Caption = "O" And s(4).Caption = "O" And s(6).Caption = "O" Then
iwon = False
cwon = True
tie = False
Line5(7).Visible = True
End If
If s(0) <> "" And s(1) <> "" And s(2) <> "" And s(3) <> "" And s(4) <> "" And s(5) <> "" And s(6) <> "" And s(7) <> "" And s(8) <> "" And cwon = False And iwon = False Then
tie = True
iwon = False
cwon = False
End If
End Sub
Private Sub Timer2_Timer()
If iwon = True Then
Timer1.Interval = 0
Timer2.Interval = 0
x = MsgBox("X's win.", vbOKOnly, "Tic Tac Toe")
End If
If cwon = True Then
Timer1.Interval = 0
Timer2.Interval = 0
o = MsgBox("O's win.", vbOKOnly, "Tic Tac Toe")
End If
If tie = True Then
Timer1.Interval = 0
Timer2.Interval = 0
ci = MsgBox("There is no winner. It's a tie.", vbOKOnly, "Tic Tac Toe")